Description:
Read an Excel file and return an Excel file object.
Syntax:
f.xlsopen(p)
Note:
The function reads Excel file f and returns an Excel file object, which can be saved as a read-only table sequence, which includes three attributes: stname (page name), nrows (number of rows) and ncols (number of columns). When f is large, use @r and @w options to retrieve data from it.
Parameter:
|
f |
An Excel file. |
|
p |
The password for opening an Excel file; can be omitted if there isn’t a password. |
Option:
|
@r |
Read data in a stream style; support only xlsx files. |
|
@w |
Write data in a stream style; doesn’t support returning the index and support only xlsx files; this option and @r option are mutually exclusive. |
Return value:
Excel file object
Example:
|
|
A |
|
|
1 |
=file("D:/ex1.xls") |
|
|
2 |
=A1.xlsopen("123") |
Read the xls file whose password is 123 and return an Excel object:
|
|
3 |
=A2.xlsimport() |
Retrieve a table sequence from the Excel object; when there isn’t the parameter, retrieve data from the first sheet. |
|
4 |
=file("ex2.xlsx").xlsopen@r() |
Read the xlsx file without a password in the stream style and return an Excel object. |
|
5 |
>A4.xlsclose() |
Close the Excel object. |
